#创建测试套件
import time
import unittest

import HTMLTestRunner_PY3

import app
from script.test_depart_params import TestIHRMDepartment
from script.test_emp_params import TestIHRMEmployee
from script.test_login_params import TestLogin

suite=unittest.TestSuite()
#将测试用例添加到测试套件
suite.addTest(unittest.makeSuite(TestLogin))
suite.addTest(unittest.makeSuite(TestIHRMEmployee))
suite.addTest(unittest.makeSuite(TestIHRMDepartment))
#生成测试报告
with open(app.BASE_DIR + "/report/ihrm_report{}.html".format(time.strftime("%Y%m%d%H%M%S")),
    mode="wb") as f:
    #实例化HTMLTestRunner_py3
    runner=HTMLTestRunner_PY3.HTMLTestRunner(f)
    #使用runner运行测试套件
    runner.run(suite)

# with open(app.BASE_DIR + "/report/ihrm_depart{}.html".format(time.strftime("%Y%m%d%H%M%S")),
#     mode="wb") as e:
#     #实例化HTMLTestRunner_py3
#     runner=HTMLTestRunner_PY3.HTMLTestRunner(e)
#     #使用runner运行测试套件
#     runner.run(suite)


print("-" *100)





